package org.yray.javaagent;

import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtMethod;
import javassist.NotFoundException;

import java.lang.instrument.ClassFileTransformer;
import java.lang.instrument.IllegalClassFormatException;
import java.lang.instrument.Instrumentation;
import java.lang.instrument.UnmodifiableClassException;
import java.security.ProtectionDomain;
import java.util.Arrays;

public class AgentmainTraceAgent {
    public static void agentmain(String agentArgs, Instrumentation ins){
        System.out.println("AgentmainTraceAgent:"+agentArgs);
        ins.addTransformer(new MyTransformer(), true);
        Class[] classes=ins.getAllLoadedClasses();
        for(Class cls:classes)
        {

            if(cls.getName().equals("org.yray.javaagent.client.RetListCls"))
            {
                try {
                    ins.retransformClasses(cls);
                } catch (UnmodifiableClassException e) {
                    e.printStackTrace();
                }
            }
        }

    }

}